import axios from 'axios';

export const axiosRequest = ({
    url,
    method = "post",
    data,
    headers = {},
    onUploadProgress = (e) => e, // 进度回调
  }) => {
    return  new Promise((resolve,reject)=>{
        axios[method](url,data,{
            headers,
            onUploadProgress
        })
        .then((res)=>{
            resolve(res)
        })
        .catch(err=>{
            reject(err)
        })
    })
}

export const makePostRequest = async (url, data) => {
    try {
      const response = await axios.post(url, data);
      return response.data;
    } catch (error) {
      throw error;
    }
  };


